package LanQiaoCompetition.LanQiaoCompetition2;

public class Really_5 {

    public static int []numbers = new int[]{0,1,2,3,4,5,6,7,8,9};
    static int n = numbers.length;
    public  static int result = 0;

    public static void main(String args[]){
        five(0);
        System.out.println(result);
    }

    public static void five(int point){
        if(point >= n-1){
            five_judge();
            return;
        }
        for(int j=point;j<n;j++){
            five_change(point,j);
            five(point+1);
            five_change(point,j);
        }
    }
    public static void five_change(int n1,int n2){
        int c = 0;
        c = numbers[n1];
        numbers[n1] = numbers[n2];
        numbers[n2] = c;

    }

    public static void five_judge(){
        if(five_judge2(numbers[0],numbers[1]) && five_judge2(numbers[0],numbers[3]) && five_judge2(numbers[0],numbers[4]) && five_judge2(numbers[0],numbers[5])){
            if(five_judge2(numbers[1],numbers[2]) && five_judge2(numbers[1],numbers[4]) && five_judge2(numbers[1],numbers[5]) && five_judge2(numbers[1],numbers[6])){
                if(five_judge2(numbers[2],numbers[5]) && five_judge2(numbers[2],numbers[6])){
                    if(five_judge2(numbers[3],numbers[4]) && five_judge2(numbers[3],numbers[7]) && five_judge2(numbers[3],numbers[8])){
                        if(five_judge2(numbers[4],numbers[5]) && five_judge2(numbers[4],numbers[7]) && five_judge2(numbers[4],numbers[8]) && five_judge2(numbers[4],numbers[9])){
                            if(five_judge2(numbers[5],numbers[6]) && five_judge2(numbers[5],numbers[8]) && five_judge2(numbers[5],numbers[9])){
                                if(five_judge2(numbers[6],numbers[9])){
                                    if(five_judge2(numbers[7],numbers[8])){
                                        if(five_judge2(numbers[8],numbers[9])){
                                            result++;
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }

        }
    }
    public static boolean  five_judge2(int n1,int n2){
        if(n1+1==n2 || n1-1==n2){
            return false;
        }
        return true;
    }

}
